package org.jeecg.modules.post.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.StringJoiner;

/**
 * @Description: 企业岗位
 * @Author: jeecg-boot
 * @Date:   2024-07-10
 * @Version: V1.0
 */
@Data
@TableName("view_gw_post")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="gw_post对象", description="企业岗位")
public class GwPostView extends GwPost {
    private static final long serialVersionUID = 1L;

    /**企业名称*/
    @Excel(name = "企业名称", width = 15)
    @ApiModelProperty(value = "企业名称")
    private String firmName;
    /**企业ICON*/
    @Excel(name = "企业ICON", width = 15)
    @ApiModelProperty(value = "企业ICON")
    private String firmIcon;
	/**归属行业*/
	@Excel(name = "归属行业", width = 15)
    @ApiModelProperty(value = "归属行业")
    private String postProfession;
    /**企业标签*/
    @Excel(name = "企业标签", width = 15)
    @ApiModelProperty(value = "企业标签")
    private String firmTags;
    /**工作年限*/
    @Excel(name = "工作年限", width = 15)
    @ApiModelProperty(value = "工作年限")
    @TableField(exist = false)
    private String workYearString;

    public String getWorkYearString() {
        StringJoiner stringJoiner = new StringJoiner("-");
        if(this.getWorkYearsMin() != null) {
            stringJoiner.add(this.getWorkYearsMin() + "");
        }
        if(this.getWorkYearsMax() != null) {
            stringJoiner.add(this.getWorkYearsMax() + "");
        }
        if(stringJoiner.length() == 0) {
            return "不限";
        } else {
            return stringJoiner.toString() + "年";
        }
    }

    /**工资范围*/
    @Excel(name = "工资范围", width = 15)
    @ApiModelProperty(value = "工资范围")
    @TableField(exist = false)
    private String postSalaryString;

    public String getPostSalaryString() {
        StringJoiner stringJoiner = new StringJoiner("-");
        if(this.getPostSalary() != null) {
            stringJoiner.add(this.getPostSalary().divide(BigDecimal.valueOf(1000)).intValue() + "k");
        }
        if(this.getPostSalaryMax() != null) {
            stringJoiner.add(this.getPostSalaryMax().divide(BigDecimal.valueOf(1000)).intValue() + "k");
        }
        if(stringJoiner.length() == 0) {
            return "面议";
        } else {
            return stringJoiner.toString();
        }
    }
}
